package cn.tedu.sp02.service;

import cn.tedu.sp01.pojo.Item;
import cn.tedu.sp01.service.ItemService;
import lombok.extern.java.Log;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
@Slf4j
public class ItemserviceImpl implements ItemService {
    @Override
    public List<Item> getItems(String orderId) {

        ArrayList<Item> list=new ArrayList<>();
        list.add(new Item(1,"苹果",15));
        list.add(new Item(2,"栗子",15));
        list.add(new Item(3,"小米",15));
        list.add(new Item(4,"小明",15));
        list.add(new Item(5,"小李",15));

        return list;
    }

    @Override
    public void decreaseNumber(List<Item> items) {
        //减少商品库存
        for (Item item:items) {
            item.setNumber(5);
        }

    }
}
